package com.example.shop_car_2208

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.launcher.ARouter
import com.blankj.utilcode.util.SPUtils
import com.example.shop_car_2208.databinding.ActivityMain3Binding
import com.example.shop_car_2208.entity.UserEntity
import com.example.shop_car_2208.login.LofinUserActivity
import com.example.shop_car_2208.mvvm.BaseViewActivity
import com.example.shop_car_2208.mvvmdemo.LoginActivity
import com.example.shop_car_2208.net.Const
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

class MainActivity3 : BaseViewActivity<ActivityMain3Binding>() {
    override fun initData() {

    }

    override fun initView() {
        binding.user = UserEntity("八维",false,"",1,"","http://10.161.9.80:8080/res/icon/b9d018718f6444ac9680fbcd9f9e590e.jpeg",1,"","123"
            ,"","","",1,"12632")
        lifecycleScope.launch {
            for (i in 2 downTo 0){
                binding.time = i

                if (i == 0){
//                    if(SPUtils.getInstance().getString(Const.SP_TOKEN).isNotEmpty()){
//                      //  startActivity(Intent(this@MainActivity3,MainActivity::class.java))
//                        //build()查找路径 navigation控制页面进行跳转
//                        ARouter.getInstance().build("/app/MainActivity").navigation()
//                    }else{
//                        ARouter.getInstance().build("/app/login").navigation()
//                    }
                    //应用了ARouter拦截器--直接跳转的主页面，当未登录市，直接跳转登录界面
                    ARouter.getInstance().build("/app/MainActivity").navigation()
                   // startActivity(Intent(this@MainActivity3,LofinUserActivity::class.java))
                }
                delay(1000)
            }
        }
    }

    override fun getLayout(): Int {
       return R.layout.activity_main3
    }

}